package com.health.model;

import java.util.List;

import android.text.TextUtils;
import android.widget.CheckBox;

/** 1:一般人群，2：儿童，3：孕产妇，4：老年人，5：重精神病，6：高血压，7：糖尿病，8：冠心病，9：脑卒中 ，10：残疾人
 * 11为肺结核 12：建档立卡贫困户，13：计划生育特殊家庭  14：卡外贫困户  15：低保户
 * 
 * 默认值1 */

public class PeopleType {
	public static final String YBRQ = "1";
	public static final String CHILD = "2";
	public static final String WOMAN = "3";
	public static final String OLD = "4";
	public static final String JSB = "5";
	public static final String GXY = "6";
	public static final String TNB = "7";
	public static final String GXB = "8";
	public static final String NCZ = "9";
	public static final String CJR = "10";
	public static final String FJH = "11";
	public static final String JDLKPKH = "12";
	public static final String JHSYTSJT = "13";
	public static final String KWPKH = "14";
	public static final String DBH = "15";
	
	public static final String YBRQ_NAME = "一般人群";
	public static final String CHILD_NAME = "儿童";
	public static final String WOMAN_NAME = "孕产妇";
	public static final String OLD_NAME = "老年人";
	public static final String JSB_NAME = "重精神病";
	public static final String GXY_NAME = "高血压";
	public static final String TNB_NAME = "糖尿病";
	public static final String GXB_NAME = "冠心病";
	public static final String NCZ_NAME = "脑卒中";
	public static final String CJR_NAME= "残疾人";
	public static final String FJH_NAME = "肺结核";
	public static final String JDLKPKH_NAME = "建档立卡贫困户";
	public static final String JHSYTSJT_NAME = "计划生育特殊家庭";
	public static final String KWPKH_NAME = "卡外贫困户 ";
	public static final String DBH_NAME = "低保户";
	public static String getPopleType(List<CheckBox> peopleGroupChecks) {
		String peopleGroup = "";
		for (int i = 0; i < peopleGroupChecks.size(); i++) {
			CheckBox cb = peopleGroupChecks.get(i);

			switch (i) {
			case 0:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.YBRQ + ",";
				}
				break;
			case 1:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.CHILD + ",";
				}
				break;
			case 2:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.WOMAN + ",";
				}
				break;
			case 3:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.OLD + ",";
				}
				break;
			case 4:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.JSB + ",";
				}
				break;
			case 5:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.GXY + ",";
				}
				break;
			case 6:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.TNB + ",";
				}
				break;
			case 7:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.GXB + ",";
				}
				break;
			case 8:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.NCZ + ",";
				}
				break;
			case 9:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.CJR + ",";
				}
				break;
			case 10:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.FJH + ",";
				}
				break;
			case 11:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.JDLKPKH + ",";
				}
				break;
			case 12:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.JHSYTSJT + ",";
				}
				break;
			case 13:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.KWPKH + ",";
				}
				break;
			case 14:
				if (cb.isChecked()) {
					peopleGroup += PeopleType.DBH + ",";
				}
				break;
				
			default:
				break;
			}

		}
		if (TextUtils.isEmpty(peopleGroup)) {
			return PeopleType.YBRQ;
		}
		peopleGroup = peopleGroup.substring(0, peopleGroup.length() - 1);
		return peopleGroup;
	}

	public static void setPopleType(String[] pops, List<CheckBox> peopleGroupChecks) {
		for (String str : pops) {
			if (!TextUtils.isEmpty(str)) {
				int parseInt = Integer.parseInt(str);
				switch (parseInt) {
				case 1:
					peopleGroupChecks.get(0).setChecked(true);
					break;
				case 2:
					peopleGroupChecks.get(1).setChecked(true);
					break;
				case 3:
					peopleGroupChecks.get(2).setChecked(true);
					break;
				case 4:
					peopleGroupChecks.get(3).setChecked(true);
					break;
				case 5:
					peopleGroupChecks.get(4).setChecked(true);
					break;
				case 6:
					peopleGroupChecks.get(5).setChecked(true);
					break;
				case 7:
					peopleGroupChecks.get(6).setChecked(true);
					break;
				case 8:
					peopleGroupChecks.get(7).setChecked(true);
					break;
				case 9:
					peopleGroupChecks.get(8).setChecked(true);
					break;
				case 10:
					peopleGroupChecks.get(9).setChecked(true);
					break;
				case 11:
					peopleGroupChecks.get(10).setChecked(true);
					break;
				case 12:
					peopleGroupChecks.get(11).setChecked(true);
					break;
				case 13:
					peopleGroupChecks.get(12).setChecked(true);
					break;
				case 14:
					peopleGroupChecks.get(13).setChecked(true);
					break;
				case 15:
					peopleGroupChecks.get(14).setChecked(true);
					break;
				}
			}
		}
	}
}
